Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metrics clean #3403

Merged
merged 3 commits into from
May 3, 2024
Merged

Metrics clean #3403

merged 3 commits into from
May 3, 2024

Conversation

stefanosiano
Copy link
Member

📜 Description

  • Remove timestampMs from LocalMetricsAggregator
  • put toStatsdType in enum directly
  • beforeMetric wrapped in try catch
  • flush check if there are metrics before scheduling again

💡 Motivation and Context

Just a small cleanup of the metrics code

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

- put `toStatsdType` in enum directly
- beforeMetric wrapped in try catch
- flush check if there are metrics before scheduling again
Copy link
Contributor

github-actions bot commented May 2, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 369.76 ms 454.18 ms 84.42 ms
Size 1.70 MiB 2.28 MiB 592.15 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
0810952 364.51 ms 468.08 ms 103.57 ms
61981dc 388.65 ms 454.96 ms 66.31 ms
baaf637 428.12 ms 520.40 ms 92.28 ms
1ae2ec6 353.85 ms 419.71 ms 65.85 ms
c7e2fbc 377.85 ms 426.35 ms 48.50 ms
b172d4e 412.60 ms 492.68 ms 80.08 ms
4e260b3 378.73 ms 454.18 ms 75.45 ms
93a76ca 377.41 ms 448.22 ms 70.81 ms
93a76ca 381.08 ms 459.22 ms 78.14 ms
7b7964f 363.27 ms 455.32 ms 92.05 ms

App size

Revision Plain With Sentry Diff
0810952 1.72 MiB 2.27 MiB 558.21 KiB
61981dc 1.70 MiB 2.28 MiB 592.12 KiB
baaf637 1.72 MiB 2.27 MiB 558.42 KiB
1ae2ec6 1.70 MiB 2.27 MiB 584.63 KiB
c7e2fbc 1.72 MiB 2.29 MiB 576.40 KiB
b172d4e 1.72 MiB 2.29 MiB 578.09 KiB
4e260b3 1.72 MiB 2.27 MiB 554.95 KiB
93a76ca 1.72 MiB 2.29 MiB 576.75 KiB
93a76ca 1.72 MiB 2.29 MiB 576.75 KiB
7b7964f 1.70 MiB 2.28 MiB 592.12 KiB

Previous results on branch: enh/metrics-cleanup

Startup times

Revision Plain With Sentry Diff
4c051c4 331.11 ms 426.71 ms 95.60 ms
82ddb6c 474.15 ms 570.88 ms 96.73 ms

App size

Revision Plain With Sentry Diff
4c051c4 1.70 MiB 2.28 MiB 591.96 KiB
82ddb6c 1.70 MiB 2.28 MiB 591.96 KiB

@stefanosiano stefanosiano marked this pull request as ready for review May 2, 2024 12:56
Copy link
Member

@markushi markushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, very nice!

final @NotNull String statsdCode;

MetricType(final @NotNull String statsdCode) {
this.statsdCode = statsdCode;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I separated MetricType from Statsd on purpose: If we ever decide to use a different protocol, we would only need to refactor some helpers and transport specific code. But I'm still fine with doing it this way, as that's what other SDKs are doing as well.

@stefanosiano stefanosiano enabled auto-merge (squash) May 3, 2024 10:39
@stefanosiano stefanosiano merged commit 8d236f4 into main May 3, 2024
24 checks passed
@stefanosiano stefanosiano deleted the enh/metrics-cleanup branch May 3, 2024 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants